#include <stdio.h>
#include <string.h>

int isRotatedString(char* s1, char* s2) {
    int len1 = strlen(s1);
    int len2 = strlen(s2);
    if (len1 != len2) { // 如果两个字符串长度不同，直接返回false
        return 0;
    }
    char reversed[len1 + 1]; // 反转字符串需要一个额外的空间
    int i = 0;
    while (i < len1) {
        reversed[len1 - i - 1] = s2[i];
        i++;
    }
    reversed[len1] = '\0'; // 添加字符串结束符
    return strcmp(s1, reversed) == 0; // 比较反转后的字符串和原字符串是否相同
}

int main() {
    char s1[] = "Hello";
    char s2[] = "loleH";
    if (isRotatedString(s1, s2)) {
        printf("s2 is a rotated string of s1\n");
    } else {
        printf("s2 is not a rotated string of s1\n");
    }
    return 0;
}